<?php

namespace app\admin\model;

use think\Model;
use traits\model\SoftDelete;

class ShopPlatform2 extends Model
{
    // 表名
    protected $name = 'shop_platform';
    
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = 'datetime';
    protected $dateFormat = 'Y-m-d H:i:s';
    // 定义时间戳字段名
    protected $createTime = 'create_dt';
    protected $updateTime = 'update_dt'; 
    protected $connection = 'slavedatabase'; 

    // 追加属性
    protected $append = [
        'qrcode_pic_url',
    ];

    public function getQrcodePicUrlAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['qrcode_pic']) ? $data['qrcode_pic'] : '');
        return config('upload_domain').$value;
    }

}
